/** */

<template>
  <AInput
    :value="dataValue"
    :placeholder="placeholder"
    :allow-clear="allowClear"
    @change="handleChange"
  />
</template>

<script>
import { AInput } from './util/AComponent'

export default {
  name: 'FCInput',
  components: {
    AInput,
  },
  model: {
    prop: 'value',
    event: 'change',
  },
  props: {
    // value props
    value: [String, Number],

    // view props

    // event props
    disabled: Boolean,

    // value map props

    // input props
    placeholder: {
      type: [String, Number],
      default: '请输入',
    },
    allowClear: Boolean,
  },
  data() {
    return {
      dataValue: this.value,
    }
  },
  computed: {},
  watch: {
    value: {
      // immediate: true,
      handler(value) {
        this.dataValue = value
      },
    },
    dataValue(value) {
      this.$emit('change', value)
    },
  },
  methods: {
    handleChange(e) {
      const value = e.target.value
      this.dataValue = value
    },
  },
}
</script>

<style></style>
